Setting method parameter defaults seems like a tidy way to make a method more usable. However, function pointers to methods with defaulted
parameters can be confusing, because the function signature may not seem to match the call signature. Therefore, the use of multiple, overloaded
methods is preferred.
Noncompliant code example
void HelloWorld (string name="World")
{
cout << "Hello " << name << endl;
}
Compliant solution
void HelloWorld (string name)
{
cout << "Hello " << name << endl;
}
void HelloWorld ()
{
HelloWorld("World");
}